**Stata do file to replicate results in paper and online appendix for Martinez-Gallardo et al., "Executive Approval Dynamics in Presidential and Parliamentary Democratic Regimes" in Comparative Political Studies**

use "M-G et al CPS.dta", clear

**Article Body**

***Figure 1a***
twoway (lpolyci Approval_Smooth std_ticker_election), scheme(s1color) by(parl)
***Figure 1b***
twoway (lpolyci mc_approval_election std_ticker_election), scheme(s1color) by(parl)

**cointegration test--coinegrated**
preserve
reg Approval_S  q_growth q_inflation parl
keep if e(sample)
xtcointtest kao Approval_S q_inflation q_growth

**unit root tests--some panels do not have unit roots******
xtunitroot fisher Approval_S, dfuller lags(0)
xtunitroot fisher q_growth, dfuller lags(0)
xtunitroot fisher q_inflation, dfuller lags(0)
restore

**Table 1**
xtreg Approval_S lag_a male l(0/1).q_growth l(0/1).q_inflation vdem_polyarchy parl l(0/2).election f(1/2).election , re
outreg2 using "pres_pm baseline", excel replace label
xtreg Approval_S lag_a male l(0/1).q_growth l(0/1).q_inflation vdem_polyarchy l(0/2).election##c.parl f(1/2).election##c.parl , re
outreg2 using "pres_pm baseline dynamics", excel replace label


**Table 2**
xtreg Approval_S lag_a male l(0/1).q_growth l(0/1).q_inflation vdem_polyarchy  l(0/2).election_type##parl  f(1/2).election##parl  , re
outreg2 using "pres_pm reelection", excel replace label dec(3) 

**Figure 2**
margins,  at(election_type=0 l.election_type=0 l2.election_type=0 f.election=0 f2.election=0 parl=(0 1)) at(election_type=1 l.election_type=1 l2.election_type=1 f.election=0 f2.election=0 parl=(0 1)) at(election_type=2 l.election_type=2 l2.election_type=2 f.election=0 f2.election=0 parl=(0 1)) level(90) 
marginsplot, by(parl) recast(scatter) scheme(s1color)

**Figure 3**
xtreg Approval_S lag_a male l(1).q_growth l(1).q_inflation  vdem_poly l(0/2).i.election_type##parl_minority_gov##parl_coalition  f(1/2).election  if parl==1, re

margins,  at( parl_minority_gov =(0 1) parl_coalition =(0 1) election=0 l.election=0 l2.election=0 f.election=0 f2.election=0 ) at( parl_minority_gov =(0 1) parl_coalition =(0 1) election=1 l.election=1 l2.election=1 f.election=0 f2.election=0 ) at( parl_minority_gov =(0 1) parl_coalition =(0 1) election=2 l.election=2 l2.election=2 f.election=0 f2.election=0 )  level(90)
marginsplot, by(parl_minority_gov parl_coalition) recast(scatter) scheme(s1color)

**Table 3**
 
xtreg Approval_S lag_a male l(1).q_growth l(1).q_inflation vdem_polyarchy  l(0/2).election_type##c.vol_tot  l(0/2).election_type##i.parl f(1/2).election  , re
outreg2 using "volatitlity and election types", excel replace label dec(3) 
  
xtreg Approval_S lag_a male l(1).q_growth l(1).q_inflation vdem_polyarchy  l(0/2).election_type##c.vol_tot  f(1/2).election if parl==0, re
outreg2 using "volatitlity and election types--Pres", excel replace label dec(3) 

xtreg Approval_S lag_a male l(1).q_growth l(1).q_inflation vdem_polyarchy  l(0/2).election_type##c.vol_tot  f(1/2).election if parl==1, re
outreg2 using "volatitlity and election types--PM", excel replace label dec(3) 

**Figure 4**
xtreg Approval_S lag_a male l(1).q_growth l(1).q_inflation vdem_polyarchy  l(0/2).election_type##c.vol_tot  l(0/2).election_type##i.parl f(1/2).election, re
 
margins,  at(election_type=0 l.election_type=0 l2.election_type=0 f.election=0 f2.election=0 parl=(0 1)) at(election_type=1 l.election_type=1 l2.election_type=1 f.election=0 f2.election=0 parl=(0 1)) at(election_type=2 l.election_type=2 l2.election_type=2 f.election=0 f2.election=0 parl=(0 1)) level(90) 
marginsplot, by(parl)  recast(scatter) scheme(s1color)

***Figure 5***
**non-elected Pres and PM
twoway (lpolyci mc_approval_admin std_ticker_admin if elected==0, level(90)) (lpolyci  mc_approval_admin std_ticker_admin if elected==1, level(90)), scheme(s1color) by(parl)


***Appendix***

**Table A1**
preserve
xtreg Approval_S lag_a male l(0/1).q_growth l(0/1).q_inflation vdem_polyarchy parl l(0/2).election f(1/2).election , re
keep if e(sample)
gen last=qtr
format last %tq
collapse (min) qtr (max) last, by (Country)
decode Country, gen(temp)
sort temp
edit
restore

**Table A2**
xtreg Approval_S lag_a male l(0/1).q_growth l(0/1).q_inflation vdem_polyarchy parl l(0/2).election f(1/2).election , re
sum Approval_S male q_growth q_inflation vdem_polyarchy election_type parl LumPers vol_tot if e(sample)

**Table A3**
**PCSE***
xtpcse Approval_S lag_a male l(1).q_growth l(1).q_inflation vdem_polyarchy l(0/2).election_type##c.parl f(1/2).election##c.parl , 
outreg2 using "appendix pcse", excel replace dec(3) paren

**GLS**
xtgls Approval_S lag_a male l(1).q_growth l(1).q_inflation vdem_polyarchy l(0/2).election_type##c.parl f(1/2).election##c.parl , panels(heteroskedastic) 
outreg2 using "appendix gls", excel replace dec(3) paren

**Table A4**
xtreg Approval_S lag_a male l(1).q_growth l(1).log_q_inflation vdem_polyarchy  l(0/2).election_type##parl  f(1/2).election##parl  , re
outreg2 using "appendix log inflation", excel replace dec(3) paren

**Table A5**
****Terrorism***
xtreg Approval_S lag_a male l(1).q_growth l(1).q_inflation vdem_polyarchy  l(0/2).election_type##i.parl f(1/2).election attack  , re
outreg2 using "security--attacks",  dec(3) replace label excel

**Vdem Corruption**
xtreg Approval_S lag_a male l(1).q_growth l(1).q_inflation vdem_polyarchy l(0/2).election_type##i.parl f(1/2).election vdem_leader_corr , re
outreg2 using "corruption",  dec(3) replace label excel

**BCI Corruption**
xtreg Approval_S lag_a male l(1).q_growth l(1).q_inflation vdem_polyarchy l(0/2).election_type##i.parl f(1/2).election bci_cor, re
outreg2 using "corruption",  dec(3) append label excel 

**Table A6**
xtreg Approval_S lag_a male l(1).q_growth l(1).q_inflation vdem_polyarchy  l(0/2).election_type##parl f(1/2).election  dem_age, re
outreg2 using "reelection and dem age", excel label dec(3) replace

**Table A7**
***LumPers personalism**
xtreg Approval_S lag_a male l(1).q_growth l(1).q_inflation vdem_polyarchy  l(0/2).election_type##c.LumPers l(0/2).election_type##c.parl f(1/2).election , re
outreg2 using "LumPers", excel replace dec(3) paren label

**vdem personalism**
xtreg Approval_S lag_a male l(1).q_growth l(1).q_inflation vdem_polyarchy  l(0/2).election_type##c.vdem_leader_legit l(0/2).election_type##c.parl f(1/2).election  , re
outreg2 using  "vdem personalism", excel replace dec(3) paren label

**Table A8**
xtreg Approval_S lag_a male l(1).q_growth l(1).q_inflation vdem_polyarchy  l(0/2).election_type##c.enpp l(0/2).election_type##c.parl f(1/2).election  , re
 outreg2 using  "enpp", excel replace dec(3) paren label
 
**Table A9**
xtreg Approval_S lag_a male l(1).q_growth l(1).q_inflation vdem_polyarchy l(0/2).election_type##c.final_result f(1/2).election , re
outreg2 using "pres vote percent",  dec(3) replace label excel paren

**Table A10**
xtreg Approval_S lag_a male l(1).q_growth l(1).q_inflation vdem_polyarchy l(0/2).election_type##c.parl f(1/2).election if series_length>100, re
outreg2 using "only long series",  dec(3) replace label excel paren

**Table A11**
xtreg Approval_S lag_a male l(1).q_growth l(1).q_inflation  vdem_poly l(0/2).i.election_type##parl_minority_gov##parl_coalition  f(1/2).election  if parl==1, re
outreg2 using "pm coal_minority", excel replace label paren t(3)

**Figure A1**
twoway (lpolyci Approval_Smooth std_ticker_admin), scheme(s1color) by(parl)
twoway (lpolyci mc_approval_admin std_ticker_admin), scheme(s1color) by(parl)

**Figure A2**
xtreg Approval_S lag_a male l(1).q_growth l(1).q_inflation vdem_polyarchy l(0/2).election_type##c.final_result f(1/2).election , re

margins, at( final=(40 62) election=(0 ) l.election=(0 ) l2.election=(0 ) F.election=0 F2.election=0) at( final=(40 62) election=(1 ) l.election=(1 ) l2.election=(1 ) F.election=0 F2.election=0) at( final=(40 62) election=(2 ) l.election=(2 ) l2.election=(2 ) F.election=0 F2.election=0) level(90)
marginsplot, by(final_result) recast(scatter) scheme(s1color)

**Figure A3**
xtreg Approval_S lag_a male l(0/1).q_growth l(0/1).q_inflation vdem_polyarchy  l(0/2).i.election_type##i.parl  f(1/2).election if latin_america==0, re
 
margins,  at(election_type=0 l.election_type=0 l2.election_type=0 f.election=0 f2.election=0 parl=(0 1)) at(election_type=1 l.election_type=1 l2.election_type=1 f.election=0 f2.election=0 parl=(0 1)) at(election_type=2 l.election_type=2 l2.election_type=2 f.election=0 f2.election=0 parl=(0 1)) level(90) 
marginsplot, by(parl) recast(scatter) scheme(s1color)

**Figure A3**
preserve
keep if Country==32 | Country==33
twoway (lpolyci Approval_Smooth std_ticker_election), scheme(s1color) by(Country)
twoway (lpolyci mc_approval_election std_ticker_election), scheme(s1color) by(Country)
restore

**Figure A4**
xtreg Approval_S lag_a male l(1).q_growth l(1).q_inflation vdem_polyarchy  l(0/2).election_type##c.log_vol_tot  l(0/2).election_type##i.parl f(1/2).election, re

margins,  at(election_type=0 l.election_type=0 l2.election_type=0 f.election=0 f2.election=0 parl=(0 1)) at(election_type=1 l.election_type=1 l2.election_type=1 f.election=0 f2.election=0 parl=(0 1)) at(election_type=2 l.election_type=2 l2.election_type=2 f.election=0 f2.election=0 parl=(0 1)) level(90) 
marginsplot, by(parl)  recast(scatter) scheme(s1color)

**Figure A6**
xtile vol_quin_pres =vol_tot if parl==0, n(5) 
xtile vol_quin_pm =vol_tot if parl==1, n(5) 
gen vol_high=1 if vol_quin_pres==5
replace vol_high=0 if vol_quin_pres==1
replace vol_high=1 if vol_quin_pm==5
replace vol_high=0 if vol_quin_pm==1
**Presidents**
twoway (lpolyci mc_approval_election std_ticker_election if parl==0 ), scheme(s1color) by(vol_high)
**PMs**
twoway (lpolyci mc_approval_election std_ticker_election if parl==1 ), scheme(s1color) by(vol_high)

**Figure A7**
hist vol_tot, by(parl) scheme(s1color)











